<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<head>
  <meta charset="UTF-8">
  <title>v-model</title>
</head>
<body>
<div id="app">
  <input type="text" v-model="message" @keyup.enter="getM">
  <input type="submit" @click="setM">
  <h2>{{message}}</h2>
</div>
<script>
  var app = new Vue({
    el:"#app",
    data:{
      message:"黑马程序员",
    },
    methods:{
      getM:function () {
        alert(this.message);
      },
      setM:function () {
        this.message="JAVA";
      }
    }
  })
</script>
</body>
</html>
